package com.blackcat.dynamicexcel.controller;


import com.alibaba.fastjson.JSONArray;
import com.blackcat.dynamicexcel.demo.vo.ExcelFrontEndParameter;
import com.blackcat.dynamicexcel.entity.ExcelTemplate;
import com.blackcat.dynamicexcel.service.DynamicExcelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * Excel模板 前端控制器
 * </p>
 *
 * @author blackcat
 * @since 2022-12-23
 */
@RestController
@RequestMapping("/excel")
public class ExcelController {

    @Autowired
    private DynamicExcelService dynamicExcelService;

    /**
     * excel配置导出
     * @author : zhanghui
     * @cteateTime : 2023/11/29 16:09
     * @param excelId 模板ID，空则导出所有
    */
    @RequestMapping(value = "/configurationExport",method = RequestMethod.GET,produces = "application/json;charset=utf-8")
    public String configurationExport(String excelId) {
        return dynamicExcelService.configurationExport(excelId);
    }

    /**
     * excel配置导入
     * @author : zhanghui
     * @cteateTime : 2023/11/29 17:06
     * @param excelList 配置信息
    */
    @RequestMapping(value = "/configurationImport",method = RequestMethod.POST)
    public String configurationImport(@RequestBody List<ExcelTemplate> excelList) {
        System.out.println(excelList);
        return "ok";
    }

}
